﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using ABC.Business.Models;
using ABC.Core.Configuration;
using ABC.Domain.Entities;
using ABC.Domain.Enums;

namespace ABC.Controllers.ViewModels.My
{
    public class MyAccountViewModel : BaseViewModel
    {
        public string FirstName { get; set; }

        public string LastName { get; set; }

        public string MiddleName { get; set; }

        public string BirthDay { get; set; }

        public string Sex { get; set; }

        public string Company { get; set; }

        public string Post { get; set; }

        public string Department { get; set; }

        public string PhoneType { get; set; }

        public string ImType { get; set; }

        public string Region { get; set; }

        public string Adress { get; set; }

        public string TopPassword { get; set; }

        public string DateLawToCar { get; set; }

        public string NewPassword { get; set; }

        public string Avatar { get; set; }

        public List<SelectListItem> ListForRegion { get; set; }

        public List<SelectListItem> ListForSocNet { get; set; }

        public List<FieldWithDrop> ListPhones { get; set; }

        public List<FieldWithDrop> ListEmails { get; set; }

        public List<FieldWithDrop> ListIm { get; set; }

        public List<FieldWithDrop> ListSocNetworks{ get; set; }

        public List<Field> ListAddresses { get; set; }

        public MyAccountViewModel()
        {
            var rosModel = IoC.Resolve<RosModel>();
            FirstName = CurrentUser.FirstName;
            LastName = CurrentUser.LastName;
            MiddleName = CurrentUser.MiddleName;
            Sex = CurrentUser.Sex;
            BirthDay = CurrentUser.BirthDay == DateTime.MinValue ? "" : CurrentUser.BirthDay.ToString("dd.MM.yyyy");
            Region = CurrentUser.Region;
            Avatar = CurrentUser.Avatar;
            TopPassword = CurrentUser.Password;
            DateLawToCar = rosModel.GetEntityValue<DateTime>(CurrentUser.Id, "ДатаПолученияПрав").ToString("dd.MM.yyyy");
            Company = rosModel.GetEntityValue<string>(CurrentUser.Id, "Компания");
            Post = rosModel.GetEntityValue<string>(CurrentUser.Id, "Должность");
            Department = rosModel.GetEntityValue<string>(CurrentUser.Id, "Отдел");
            ListPhones = new List<FieldWithDrop>();
            ListIm = new List<FieldWithDrop>();
            ListEmails = new List<FieldWithDrop>();
            ListSocNetworks = new List<FieldWithDrop>();
            ListAddresses = new List<Field>();
            ListForRegion = new List<SelectListItem>{ new SelectListItem {Text = "Москва и область", Value = "Москва и область"}, 
                                                      new SelectListItem {Text = "Санкт-Петербург и область", Value = "Санкт-Петербург и область"} 
            };
            ListForSocNet = new List<SelectListItem>{ new SelectListItem {Text = "Вконтакте", Value = SocialNetworkType.Вконтакте.ToString()}, 
                                                    new SelectListItem {Text = "Одноклассники", Value = SocialNetworkType.Одноклассники.ToString()},
                                                    new SelectListItem {Text = "Мой Мир", Value = SocialNetworkType.МойМир.ToString()},
                                                    new SelectListItem {Text = "Facebook", Value =SocialNetworkType.Facebook.ToString()},
                                                    new SelectListItem {Text = "MySpace", Value = SocialNetworkType.MySpace.ToString()}
            };

        }
    }
}
